{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<a href=\"https://colab.research.google.com/github/jeffheaton/t81_558_deep_learning/blob/master/manual_setup.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# T81-558: Applications of Deep Neural Networks\n",
    "**Manual Python Setup**\n",
    "* Instructor: [Jeff Heaton](https://sites.wustl.edu/jeffheaton/), McKelvey School of Engineering, [Washington University in St. Louis](https://engineering.wustl.edu/Programs/Pages/default.aspx)\n",
    "* For more information visit the [class website](https://sites.wustl.edu/jeffheaton/t81-558/)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Software Installation\n",
    "This class is technically oriented.  A successful student needs to be able to compile and execute Python code that makes use of TensorFlow for deep learning. There are two options for you to accomplish this:\n",
    "\n",
    "* Install Python, TensorFlow and some IDE (Jupyter, TensorFlow, and others)\n",
    "* Use Google CoLab in the cloud\n",
    "\n",
    "## Step 1: NVIDIA Video Driver\n",
    "\n",
    "You should install the latest version of your GPUs driver.  You can download drivers here:\n",
    "\n",
    "* [NVIDIA GPU Drive Download](https://www.nvidia.com/Download/index.aspx)\n",
    "\n",
    "## Step 2: Visual Studio, C++\n",
    "\n",
    "You will need Visual Studio, with C++ installed.  By default, C++ is not installed with Visual Studio, so make sure you select all of the C++ options.\n",
    "\n",
    "* [Visual Studio Community Edition](https://visualstudio.microsoft.com/vs/community/)\n",
    "\n",
    "\n",
    "## Step 3: CUDA\n",
    "\n",
    "Look at the TensorFlow install guide to see what version of CUDA it calls for. \n",
    "\n",
    "* [TensorFlow GPU Guide](https://www.tensorflow.org/install/gpu)\n",
    "\n",
    "Then download that (or a later) version of CUDA from the following site:\n",
    "\n",
    "* [CUDA Toolkit Download](https://developer.nvidia.com/cuda-downloads)\n",
    "\n",
    "## Step 4: CuDNN\n",
    "\n",
    "* [CuDNN](https://developer.nvidia.com/cudnn)\n",
    "\n",
    "## Step 5: Ana/Miniconda\n",
    "\n",
    "You can download Anaconda from this\n",
    "\n",
    "## Step 6: Jupyter\n",
    "\n",
    "```\n",
    "conda install -y jupyter\n",
    "```\n",
    "\n",
    "## Step 7: Environment\n",
    "\n",
    "```\n",
    "conda create -y --name tensorflow python=3.9\n",
    "```\n",
    "\n",
    "To enter this environment, you must use the following command (**for Windows**), this command must be done every time you open a new Anaconda/Miniconda terminal window:\n",
    "\n",
    "```\n",
    "activate tensorflow\n",
    "```\n",
    "\n",
    "## Step 8: Jupyter Kernel\n",
    "\n",
    "It is easy to install Jupyter notebooks with the following command:\n",
    "\n",
    "```\n",
    "conda install -y jupyter\n",
    "```\n",
    "\n",
    "Once Jupyter is installed, it is started with the following command:\n",
    "\n",
    "```\n",
    "jupyter notebook\n",
    "```\n",
    "\n",
    "## Step 9: Install TensorFlow/Keras\n",
    "\n",
    "```\n",
    "pip install tensorflow\n",
    "```\n",
    "\n",
    "## Step 10: Testing\n",
    "\n",
    "```\n",
    "import tensorflow as tf\n",
    "print(tf.__version__)\n",
    "print(len(tf.config.list_physical_devices('GPU'))>0)\n",
    "```\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Tensor Flow Version: 2.0.0-beta1\n",
      "Keras Version: 2.2.4-tf\n",
      "\n",
      "Python 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 13:42:17) \n",
      "[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]\n",
      "Pandas 0.25.0\n",
      "Scikit-Learn 0.21.3\n",
      "GPU is NOT AVAILABLE\n"
     ]
    }
   ],
   "source": [
    "# What version of Python do you have?\n",
    "import sys\n",
    "\n",
    "import tensorflow.keras\n",
    "import pandas as pd\n",
    "import sklearn as sk\n",
    "import tensorflow as tf\n",
    "\n",
    "print(f\"Tensor Flow Version: {tf.__version__}\")\n",
    "print(f\"Keras Version: {tensorflow.keras.__version__}\")\n",
    "print()\n",
    "print(f\"Python {sys.version}\")\n",
    "print(f\"Pandas {pd.__version__}\")\n",
    "print(f\"Scikit-Learn {sk.__version__}\")\n",
    "print(\"GPU is\", \"available\" if tf.test.is_gpu_available() else \"NOT AVAILABLE\")"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3.9 (tensorflow)",
   "language": "python",
   "name": "tensorflow"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
